package com.training.java.core.collections.television.pre15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class TelevisionArrayListDemo {

	public static void main(String[] args) {
		Television tv1= new Television("Samsung","LCD",true);
		Television tv2= new Television("LG","LED",false);
		Television tv3= new Television("Sony","plasma",true);
		Television tv4= new Television("Sony","plasma",true);
		
		
		tv1.setPrice(200);
		tv2.setPrice(300);
		tv3.setPrice(400);
		tv4.setPrice(400);
		
		List listOfTV = new ArrayList();
		listOfTV.add(tv1);
		listOfTV.add(tv2);
		listOfTV.add(tv3);
		listOfTV.add(tv4);
		
		
		Iterator ite = listOfTV.iterator();
		 while(ite.hasNext())
		 {
			 Television tv=(Television)ite.next();
			 System.out.println("Company: "+ tv.getCompany());
			 System.out.println("model: "+ tv.getType());
			 System.out.println("3DEnabled: "+ tv.isThreeDEnabled());
			 System.out.println("price: "+ tv.getPrice());
			 System.out.println("********************");
		 }
		
		System.out.println(" Are tv3 and tv4 equal:" + tv3.equals(tv4));
		System.out.println("hashcode for tv3 based on company:" + tv3.hashCode());
		System.out.println("hashcode for tv4 based on company:" + tv4.hashCode());
		//  if we change the type of tv3 or tv4 then also hashcode for company will be displayed.
	}

}
